<template>
	<view class="contation">
		<view class="setting_list">
			<view class="list flex flex-align flex-bt" v-for="(item,index) in dataInfo" :key="index" @click="get_qie(item.id)">
				<view class="left">{{item.nickname}} ( {{item.inviter_code}} )</view>
				<view class="right flex flex-align">
					<view class=""  v-if="code==item.inviter_code">
						<tui-icon name="check" :size="18" color="#f20"></tui-icon>
					</view>
					<tui-icon name="arrowright" :size="24" color="#999"></tui-icon>
				</view>
			</view>
		</view> 
	</view>
</template>

<script>
	export default {
		
		data() {
			return {
				title: 'Hello',
				modal:false,
				name:'',
				modal2:false,
				dataInfo:[],
				type:'',
				code:''
			}
		},
		
		onLoad(e) {
			this.code = e.code
		},
		onShow() {
			this.getdata()
		},
		methods: {
			
			getdata(){
				let that = this
				that.tui.request("api.auth.center/toggleList", "POST", {}, false, false, true).then((res) => {
					if(res.code==1){
						that.dataInfo = res.data.list
					}
				}).catch((res) => {
					
				})
			},
			get_qie(e){
				let that = this
				let tokens = ''
				that.tui.request("api.auth.center/toggle", "POST", {uuid:e}, false, false, true).then((res) => {
					that.tui.toast(res.info)
					if(res.code==1){
						uni.setStorageSync('d_token', res.data.token)
						setTimeout(function(){
							uni.navigateBack()
						},1000)
					}
				}).catch((res) => {
					
				})
			},
		}
	}
</script>

<style lang="scss">
	page{background: #fff;}
	.setting_list{
		.list{padding: 30rpx;border-bottom: 1px solid #eee;
			.right{
				image{width: 80rpx;height: 80rpx;border-radius: 100%;}
			}
		}
	}
	.setting_bot{
		background: #333;color: #fff;line-height: 90rpx;text-align: center;position: fixed;bottom: 0;left: 0;width: 100%;
	}
	.tui-modal-custom{
		.title{line-height: 70rpx;border-bottom: 1px solid #eee;margin-bottom: 40rpx;
			.left{font-weight: bold;font-size: 32rpx;}
			.clsoe{color: #818181;}
		}
		.int{border: 1px solid #eee;padding:30rpx 20rpx ;
			input{width: 100%;}
		}
		.btn{background: #333;color: #fff;border-radius: 10rpx;line-height: 90rpx;margin: 40rpx 0 20rpx;text-align: center;}
	}
</style>